package org.kjtc.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.kjtc.entity.FeedBack;

import java.util.List;

/**
 * Created by Administrator on 2017/12/4 0004.
 */
@Mapper
public interface FeedBackMapper {

    @Select("select v.ProductVersionID, v.ProductVersionName, p.ProductID, p.ProductName, m.ModuleID, m.ModuleName, f.FeedBackUser,\n" +
            " u.UserName, f.CreateDTTM, f.FeedBackDescription, f.FeedBackStatus, f.FeedBackScreenshotPath, f.FeedBackEnclosurePath, f.FeedBackAffirmant," +
            " f.FeedBackID from feedback f\n" +
            "LEFT JOIN module m ON f.ModuleID = m.ModuleID\n" +
            "LEFT JOIN productversion v ON v.ProductVersionID = m.ProductVersionID\n" +
            "LEFT JOIN product p ON p.ProductID = v.ProductID\n" +
            "LEFT JOIN userinfo u ON f.FeedBackUser = u.UserID\n" +
            "where v.ProductVersionID = #{ProductVersionID} and p.ProductID = #{ProductID} and FeedBackStatus = #{FeedBackStatus}")
    List<FeedBack> doGetFeedBackMsg(FeedBack feedBack);

    @Update("update " +
            "feedback " +
            "set " +
            "UpdateUser = #{UpdateUser}," +
            "UpdateDTTM = SYSDATE()," +
            "FeedBackAffirmant = #{FeedBackAffirmant}," +
            "FeedBackStatus = #{FeedBackStatus} " +
            " where " +
            "FeedBackID = #{FeedBackID}")
    int updateFeed(FeedBack feedBack);
}
